using CarparkIMS_Model;
using Newtonsoft.Json;
using System;
using System.ComponentModel.DataAnnotations;

namespace CarparkIMS_CMS.Models
{
    public class llqqPlateLogViewModel: llqqPlateLog
    {
        public llqqPlateLogViewModel(llqqPlateLog model, int TransactionTypeID = 1)
        {
            foreach (var prop in model.GetType().GetProperties())
            {
                this.GetType().GetProperty(prop.Name).SetValue(this, prop.GetValue(model, null), null);
            }

            this.date = this.date.Replace("T", " ").Substring(0, 19);
            this.TransactionTypeID = TransactionTypeID;
        }

        public string isValidPlate => this.isValid == true ? "Y" : "N";
        public int TransactionTypeID { get; set; }
    }

    public class Login
    { 
        [JsonProperty("username")]
        public string UserName { get; set; }
         
        [JsonProperty("password")]
        public string Password { get; set; }
    }

    public class LoginSuccessCookieModel
    {
        public string UserName { get; set; }
        public string ApiSession { get; set; }
        public long Expires { get; set; }
    }
}
